package online.longzipeng.cinemasys.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import online.longzipeng.cinemasys.common.result.Result;
import online.longzipeng.cinemasys.entity.SysUser;
import online.longzipeng.cinemasys.service.WebConfigService;
import online.longzipeng.cinemasys.vo.webconfig.WebConfigUpdateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lzp
 * @since 2021-05-13
 */
@RestController
@RequestMapping("/web-config")
@Api(value = "网站配置相关接口",description = "网站配置相关接口",tags = "网站配置相关接口")
public class WebConfigController {

    @Autowired
    WebConfigService webConfigService;


    @GetMapping("/get-by-key")
    @ApiOperation("通过键获取值")
    public Result getByKey(@RequestParam("name")String name){
        String value = webConfigService.getByKey(name);
        return Result.success(value);
    }

    @PostMapping("/update-by-key")
    @ApiOperation("通过键和值更新")
    public Result updateByKey(@RequestBody WebConfigUpdateVO webConfigUpdateVO){
        webConfigService.updateByKey(webConfigUpdateVO);
        return Result.success(null,"更新成功！！");
    }

}
